package com.example.feidaolumanager.api

import com.example.feidaolumanager.pojo.MachineItem
import com.example.feidaolumanager.pojo.PageResult
import com.example.feidaolumanager.pojo.PmAvgInfo
import com.example.feidaolumanager.pojo.ResponseDTO
import com.example.feidaolumanager.pojo.VO.MachineVO
import com.example.feidaolumanager.pojo.machineCategory.MachineCategories
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Query

interface MachineService {


    @GET("/app/getMechanics")
    suspend fun getMachines(
        @Query("userid") id: Int,
        @Query("userac") userAccount: String,
        @Query("userqx") level: String,
        @Query("sel_key") selKey: Int?,
        @Query("sel_level") selLevel: Int?,
        @Query("page") page: Int? = 1,
        @Query("pageSize") pageSize: Int? = Int.MAX_VALUE,
    ): ResponseDTO<PageResult<MachineItem>>

    @POST("/mechanics/saveMechanics")
    suspend fun addMachine(
        @Body machineVO: MachineVO,
    ): ResponseDTO<String>

    @PUT("/mechanics/updateMechanics")
    suspend fun updateMachine(
        @Body machineVO: MachineItem,
    ): ResponseDTO<String>

    @GET("/adminMechanics/getcategory")
    suspend fun getMachineCategories(): ResponseDTO<MachineCategories>

    @DELETE("/mechanics/deleteMenchanicsByid")
    suspend fun deleteMachine(
        @Query("id") id: Int,
    ): ResponseDTO<String>

    @GET("/app/getappavgt")
    suspend fun getAvg(
        @Query("userid") userId: String,
        @Query("userac") userAccount: String,
        @Query("userqx") level: String
    ): ResponseDTO<ArrayList<PmAvgInfo>>
}